<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>登录页面</title>
    <link rel="stylesheet" type="text/css" href="../css/login.css">
</head>
<body>
    <div id="login" class="container">
        <h2>欢迎登录</h2>
        <form id="loginForm">
            <label for="username">账号:</label>
            <input type="text" id="username" name="username" placeholder="请输入账号" required>
            <label for="password">密码:</label>
            <input type="password" id="password" name="password" placeholder="请输入密码" required>
            <input type="submit" value="登录">
        </form>
    </div>
    <script>
        document.getElementById('loginForm').addEventListener('submit', function (e) {
            e.preventDefault();
            const username = document.getElementById('username').value;
            const password = document.getElementById('password').value;
            if (username === '2207124003 许熔婷' && password === '220706') {
                localStorage.setItem('isLoggedIn', 'true');
                localStorage.setItem('username', username);
                alert('登录成功！');
                window.location.href = 'index.html'; // 登录成功后跳转回首页
            } else {
                alert('账号或密码错误！');
            }
        });
    </script>
</body>
</html>